﻿@page "/admin/collect"
@layout AdminLayout
@attribute [Authorize]
@inject HttpClient HttpClient
@inject IPopupService PopupService

<PageTitle>采集管理</PageTitle>


<div>
    <div style="display: flex;">
        <MSelect HideDetails="@true" MinWidth="135" Clearable="@true" Label="分类" Placeholder="请选择分类" Solo Dense
                 TItem="SelectItem" TItemValue="string" TValue="string" Items="@selectItems" ItemText="u => u.Label"
                 ItemValue="u => u.Value" Style="margin-right: 20px;width: 135px;max-width: 150px;"
                 OnSelectedItemUpdate="@(e=>VcateSelectedChange(e.Value))" OnClearClick="ClearVcate">
        </MSelect>

        <MTextField Solo Dense Clearable TValue="string" @bind-Value="awaitCollectUrl"
                    Label="url地址" Placeholder="url地址" TextColor="green"
                    HideDetails="@true"></MTextField>
    </div>
    <MButton Color="primary" OnClick="AddToAwaitList" Style="margin-top: 8px;">
        <MIcon Left>mdi-plus</MIcon>
        添加
    </MButton>
</div>

<MRow Style="margin-top: 25px;">
    @*电视剧待采集*@
    <MCol Cols="4">
        <MItem>
            <MCard>
                <MCardTitle>
                    <ChildContent>
                        <div style="width: 100%;display:flex;flex-direction:row;justify-content:space-between;">
                            <h5 class="">电视剧待采集列表</h5>
                            <MButton Loading="teleplayLoading"
                                     Disabled="teleplayLoading"
                                     OnClick="startTeleplayCollect"
                                     Color="success" Small>
                                <LoaderContent>
                                    <span style="font-size:9px;">await...</span>
                                </LoaderContent>
                                <ChildContent>
                                    开始
                                </ChildContent>
                            </MButton>
                        </div>
                    </ChildContent>
                </MCardTitle>

                <MList Dense Disabled>
                    <MListItemGroup Color="primary">
                        @foreach (var item in awaitTeleplayCollectList)
                        {
                            <MListItem>
                                <MListItemContent>
                                    <MListItemTitle>@item</MListItemTitle>
                                </MListItemContent>
                            </MListItem>
                        }
                    </MListItemGroup>
                </MList>
            </MCard>
        </MItem>
    </MCol>

    @*电影待采集*@
    <MCol Cols="4">
        <MItem>
            <MCard>
                <MCardTitle>
                    <ChildContent>
                        <div style="width: 100%;display:flex;flex-direction:row;justify-content:space-between;">
                            <h5 class="">电影待采集列表</h5>
                            <MButton Loading="movieLoading"
                                     Disabled="movieLoading"
                                     OnClick="startMovieCollectAsync"
                                     Color="success" Small>
                                <LoaderContent>
                                    <span style="font-size:9px;">await...</span>
                                </LoaderContent>
                                <ChildContent>
                                    开始
                                </ChildContent>
                            </MButton>
                        </div>
                    </ChildContent>
                </MCardTitle>

                <MList Dense Disabled>
                    <MListItemGroup Color="primary">
                        @foreach (var item in awaitMovieCollectList)
                        {
                            <MListItem>
                                <MListItemContent>
                                    <MListItemTitle>@item</MListItemTitle>
                                </MListItemContent>
                            </MListItem>
                        }
                    </MListItemGroup>
                </MList>
            </MCard>
        </MItem>
    </MCol>

    @*动漫待采集*@
    <MCol Cols="4">
        <MItem>
            <MCard>
                <MCardTitle>
                    <ChildContent>
                        <div style="width: 100%;display:flex;flex-direction:row;justify-content:space-between;">
                            <h5 class="">动漫待采集列表</h5>
                            <MButton Loading="animationLoading"
                                     Disabled="animationLoading"
                                     OnClick="startAnimationCollectAsync"
                                     Color="success" Small>
                                <LoaderContent>
                                    <span style="font-size:9px;">await...</span>
                                </LoaderContent>
                                <ChildContent>
                                    开始
                                </ChildContent>
                            </MButton>
                        </div>
                    </ChildContent>
                </MCardTitle>

                <MList Dense Disabled>
                    <MListItemGroup Color="primary">
                        @foreach (var item in awaitAnimationCollectList)
                        {
                            <MListItem>
                                <MListItemContent>
                                    <MListItemTitle>@item</MListItemTitle>
                                </MListItemContent>
                            </MListItem>
                        }
                    </MListItemGroup>
                </MList>
            </MCard>
        </MItem>
    </MCol>

</MRow>